//
//  XNAllotApproveRequest.m
//  XINNingOA
//
//  Created by samuel on 2021/7/16.
//

#import "XNAllotApproveRequest.h"

@implementation XNAllotApproveRequest
{
    NSString *_orderId;
}

- (instancetype)initWithOrderId:(NSString *)orderId
{
    self = [super init];
    if (self) {
        _orderId = orderId;
    }
    return self;
}

- (NSString *)requestUrl
{
    return @"/api/Allot/LoadCheckHistory";
}

- (YTKRequestMethod)requestMethod
{
    return YTKRequestMethodGET;
}

- (id)requestArgument
{
    return @{
        @"id":_orderId,
    };
}


- (NSArray<XNBillApproveModel *> *)approveFlowArray
{
    NSDictionary *response = [self responseJSONObject];
    if (self.success) {
        NSMutableArray *flowArray = [NSMutableArray array];
        NSArray *array = response[@"result"][@"data"];
        [array enumerateObjectsUsingBlock:^(NSDictionary *obj, NSUInteger idx, BOOL * _Nonnull stop) {
            XNBillApproveModel *flow = [XNBillApproveModel modelWithDictionary:obj];
            [flowArray addObject:flow];
        }];
        return [NSArray arrayWithArray:flowArray];
        
    }else{
        return nil;
    }
}

@end
